// vuex 的代码
import Vue from 'vue'
import Vuex from 'vuex'
import State from './state'
import Mutations from './mutations'
import Actions from './actions'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

export default new Vuex.Store({
  state: State,
  actions: Actions,
  mutations: Mutations,
  plugins: [createPersistedState({
  	// 传入参数
  	storage: {
  		getItem: (key) => uni.getStorageSync(key),
  		setItem: (key, val) => uni.setStorageSync(key, val),
  		removeItem: (key) => uni.removeStorageSync(key)
  	}
  })]
})
